<?php
/**
 *   Joomdiet - administrator/components/com_joomdiet/views/dietmanager/tmpl/default.php
 *   Author: Juan Dapena Paz (juan@bittingbits.com)
 *   Copyright (C) 2011 Bitting Bits S.L.
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
defined('_JEXEC') or die('Restricted access'); ?>
<form action="index.php" method="post" name="adminForm">
    <div id="editcell">
        <table class="adminlist">
            <thead><tr>
                <th width="20">
                    <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
                </th>
                <th width="5"><?php echo JText::_('COM_JOOMDIET_ID'); ?></th>
                <th width="200px"><?php echo JText::_('COM_JOOMDIET_NAME'); ?></th>
                <th><?php echo JText::_('COM_JOOMDIET_FILE_URL'); ?></th>
                <th width="100px"><?php echo JText::_('COM_JOOMDIET_TIME'); ?></th>
                <th width="50px"><?php echo JText::_('COM_JOOMDIET_HIGHLIGHTED'); ?></th>
                <th width="50px"><?php echo JText::_('COM_JOOMDIET_DOWNLOAD'); ?></th>
                <th width="50px"><?php echo JText::_('COM_JOOMDIET_EDIT'); ?></th>
                <th width="50px"><?php echo JText::_('COM_JOOMDIET_DELETE'); ?></th>
            </tr></thead>
            <tfoot><tr>
                <td colspan="9"><?php echo $this->pagination->getListFooter(); ?></td>
            </tr></tfoot>
            <tbody>
                <?php
                    $k = 0;
                    $i = 0;
                    foreach ($this->items as &$row) {
                        $checked = JHTML::_('grid.id', $i, $row->id); ?>
                        <tr class="<?php echo 'row'.$k; ?>">
                            <td><?php echo $checked; ?></td>
                            <td><?php echo $row->id; ?></td>
                            <td><?php echo $row->name; ?></td>
                            <td><?php echo $row->file_name; ?></td>
                            <td><?php echo $row->upload_datetime; ?></td>
                            <td><?php echo $row->highlighted; ?></td>
                            <td><a href="index.php?option=com_joomdiet&controller=dietmanager&task=download&diet_id=<?php echo $row->id; ?>"><?php echo JText::_('COM_JOOMDIET_DOWNLOAD'); ?></a></td>
                            <td><a href="index.php?option=com_joomdiet&controller=dietmanager&task=editDiet&cid=<?=$row->id?>"><?php echo JText::_('COM_JOOMDIET_EDIT'); ?></a></td>
                            <td><a href="index.php?option=com_joomdiet&controller=dietmanager&task=removeDiet&cid[]=<?=$row->id?>"><?php echo JText::_('COM_JOOMDIET_DELETE'); ?></a></td>
                        </tr>
                <?php $k = 1 - $k; $i++; } ?>
            </tbody>
        </table>
    </div>
    
    <input type="hidden" name="option" value="com_joomdiet" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="controller" value="dietmanager" />
    <input type="hidden" name="view" value="dietmanager" />
</form>
